package com.shenmazg6.state;

/**
 * 订单状态枚举
 */

public enum OrderStateEnum {
    ORDER_NO_PAY(0, "订单未支付"),
    ORDER_PAYED(1, "订单已支付"),
    ORDER_CANCEL(2, "订单已取消"),
    ORDER_SEND(3, "订单已发货");

    // 成员
    private Integer code;
    private String name;

    // 构造方法
    private OrderStateEnum(int code, String name) {
        this.name = name;
        this.code = code;
    }

    // 普通方法
    public static String getName(int code) {
        for (OrderStateEnum c : OrderStateEnum.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        return null;
    }

    // get set 方法
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getCode() {
        return code;
    }
    public void setCode(int code) {
        this.code = code;
    }
}
